package com.dt76.smallloanbackenduser.remote.etao;

import com.dt76.smallloanbackenduser.hystrix.etao.EmpHystrix;
import com.dt76.smallloanbackenduser.pojo.etao.CurrentUser;
import com.dt76.smallloanbackenduser.pojo.etao.Employee;
import com.dt76.smallloanbackenduser.utils.Page;
import com.dt76.smallloanbackenduser.utils.Result;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "smallloan-backend-service",fallback = EmpHystrix.class)
public interface EmployeeRemote {

    @RequestMapping("/getPageEmp")
    Page getPageEmp(@RequestParam("empName") String empName,
                    @RequestParam("dId") Integer dId,
                    @RequestParam("pageIndex") Integer pageIndex);

    @RequestMapping("/getEmpLoginName")
    Employee getEmpLoginName(@RequestParam("empLoginName") String empLoginName);

    @RequestMapping("/updEmpEnable")
    Result updEmpEnable(@RequestParam("empId") Integer empId,
                        @RequestParam("updEnable") Integer updEnable);

    @RequestMapping("/getEmpById")
    Employee getEmpById(@RequestParam("eId") Integer eId);

    @RequestMapping("/addEmp")
    Result addEmp(@RequestBody Employee employee,@RequestParam("currentId") Integer currentId);

    @RequestMapping("/updEmp")
    Result updEmp(@RequestBody Employee employee,@RequestParam("currentId") Integer currentId);

    @RequestMapping("/delEmp")
    Result delEmp(@RequestParam("eId") Integer eId, @RequestBody CurrentUser currentUser);

    @RequestMapping("/getAllEmp")
    List<Employee> getAllEmp();

}
